echo '<form id="myForm1" name="front_end_delete" method="POST" action="">
            <input type="hidden" name="pid" id="pid" value="'.get_the_ID().'">
            <button type="submit" name="submit" id="submit" value="delete" class="btn" style="margin-left:2px;background:#f5f5f5;"><i class="fa fa-fw fa-times"></i>Изтрий</button>
        </form>';
	//function to update post status
	function change_post_status($post_id, $status){
    $current_post = get_post( $post_id, 'ARRAY_A' );
    $current_post['post_status'] = $status;
    wp_update_post($current_post);
	}

    if (isset($_POST['pid']) && !empty($_POST['pid'])){
    change_post_status((int)$_POST['pid'],'trash');
	}	

